<?php 
	error_reporting(0);

	header("Content-type:text/html;charset=utf8");
	//1. 导入连接文件
	include 'link.php';

	// if($link) {
	// 	echo "true";
	// }

	//2. 接收从上一页面传过来的数据
	$admin_name = $_POST['name'];
	$admin_pwd = $_POST['pwd'];

	$sql = "select * from admin_info 
					where admin_pwd='$admin_pwd' and admin_name = '$admin_name'"; 
	$result = mysqli_query($link,$sql);
	if($result) {
		echo "success!";
		exit(0);
	}
	$rows = mysqli_fetch_array($result);

	if($rows) {
		session_start();
		$name = $rows['admin_name'];
		$_SESSION['admin_name'] = $name;
		header("Location:admin_index.php");
	} else {
		exit('登录失败！点击此处 <a href="javascript:history.back(-1);">返回</a> 重试');
	}







 ?>